﻿angular.module('app', ['core', 'app.directives', 'ui.bootstrap'])
	.run(['$rootScope', '$document', '$timeout', '$q', 'WebApiService',
		function ($rootScope, $document, $timeout, $q, WebApiService) {
			$rootScope.siteSettingsLoaded = $q.defer();

			getSiteSettings();

			function getSiteSettings() {
				var restUri = "GET /api/site-settings/get";

				WebApiService.getSiteSettings(restUri, {},
					function (data) {
						if (data && data.meta && data.meta.code && data.meta.code === 200
							&& data.response) {
							$rootScope.urls = data.response.urls;
							$rootScope.staticResources = data.response.staticResources;
							$rootScope.user = data.response.userInfo;
						}

						$rootScope.siteSettingsLoaded.resolve(data);
					});
			}
		}
	]);